package com.FileTest;

import java.util.ArrayList;
import java.util.Properties;

public class Test02 {
    public static void main(String[] args) {
        //将下面字符串?后面的键值对保存到proerties文件中
        //String url = "http://www.lovo.com/index?name=aaaaaa&age=20&gender=男";
        String url = "http://www.lovo.com/index?name=aaaaaa&age=20&gender=男";
        Properties properties = new Properties();
        String s = url.substring(url.indexOf("?") + 1);//从？下标的下一个下标开始截取
        String[] st = s.split("&");//以&分割字符串  st :{name=aaaaaa,age=20.gender=男}
        for (int i = 0; i < st.length; i++) {
            String[] str = st[i].split("=");
            /*
            以 = 分割st数组
            i=0 str:{name,aaaaaa}
            i=1 srt:{age,20}
            i=2 srt:{gender,男}
            */
            properties.setProperty(str[0], str[1]);//将键值放进properties
        }
//        propertiesUtil.writeProperties("2.properties", properties);
        Properties properties1 = propertiesUtil.readProperties("2.properties");
        System.out.println(properties1);
    }
}
